Defining a nested single-line comment within a multi-line comment invites errors. It may lead a developer to wrongly think that the lines located
after the single-line comment are not part of the comment.
If a comment starting sequence, /*
or //
, occurs within a /*
comment, is it quite likely to be caused by a
missing */
comment ending sequence.
If a comment starting sequence occurs within a //
comment, it is probably because a region of code has been commented-out using
//
.
Noncompliant code example
/* some comment, end comment marker accidentally omitted
// Make sure this function is called in a thread safe context
Perform_Critical_Safety_Function(X);
...
/* this comment is non-compliant */
Exceptions
The sequence // is permitted within a // comment.